﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace SuporeSliplampApp.Converters
{
    public class BoolToTextConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is bool isOn)
            {
                return isOn ? "是" : "否";
            }
            return "否"; // 默认返回 "否"
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value.ToString() == "是"; // 如果是 "是"，返回 true
        }
    }
}
